//
//  YYBaseViewController.swift
//  新浪微博
//
//  Created by fdq on 16/7/19.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class YYBaseViewController: UIViewController {
	
	var isLogin : Bool = false

	var baseView : YYBaseView?
	
	override func loadView() {
		if isLogin {
			view = tableView
		}else{
			
			baseView = YYBaseView()
			baseView?.closure = {
				print("登录或注册按钮点击了")
			}
			view = baseView
		}
	}
	
	override func viewDidLoad() {
		super.viewDidLoad()
		
		setupNav()
	}
	
	//懒加载tableview
	lazy var tableView : UITableView = UITableView()
	
	//设置导航栏按钮
	func setupNav(){
		
		navigationItem.leftBarButtonItem = YYBarButtonItem(title: "登录", imgName: nil, target: self, action: "loginButtonClick")
		navigationItem.rightBarButtonItem = YYBarButtonItem(title: "注册", imgName: nil, target: self, action: "loginButtonClick")
		
	}
	
	func loginButtonClick(){
		print("----登录--注册----")
	}
}
